<?php
$this->Html->addCrumb('<i class="fa fa-home"></i> ' . Inflector::camelize($this->request->params ['prefix']), '/' . $this->request->params ['prefix'] . '/', array('escape' => false));
$this->Html->addCrumb('Comentários', array('prefix' => $this->request->params['prefix'], 'controller' => $this->request->params['controller'], 'plugin' => $this->request->params['plugin'], 'action' => 'index'), array('escape' => false));
$this->Html->addCrumb('Consultar', NULL, array('escape' => false));

$this->Html->setAcoes('<i class="fa fa-search"></i>' . __('List'), array('action' => 'index'), array('title' => __('List'), 'class' => 'btn btn-info', 'escapeTitle' => false));
$this->Html->setAcoes('<i class="fa fa-file-text-o"></i>' . __('Export'), array('action' => 'export'), array('title' => __('Export'), 'class' => 'btn btn-info', 'escapeTitle' => false));
?>


<div class="row" style="margin-bottom: 15px;">
    <?php
    echo $this->Form->create('Comentarios.Comentario', array(
        'inputDefaults' => array(
            'div' => 'form-group  col-xs-3',
            'label' => false,
            'wrapInput' => false,
            'class' => 'form-control'
        ),
        'class' => 'form-inline busca_form_intranet',
        'url' => array_merge(array('action' => 'painel_index'), $this->request->params['named']),
        'novalidate' => true,
        'formnovalidate' => false,
        'role' => 'form',
        'type' => 'post'
    ));

    echo $this->Form->input('Comentario.titulo', array('label' => false, 'placeholder' => 'Titulo', 'class' => 'form-control', 'div' => array('class' => 'col-xs-12 col-md-4')));
    echo $this->Form->input('Comentario.email', array('label' => false, 'placeholder' => 'E-mail', 'class' => 'form-control', 'div' => array('class' => 'col-xs-12 col-md-4')));
    echo $this->Form->status('Comentario.status', array('empty' => 'Todas Situações', 'label' => false, 'class' => 'form-control', 'div' => array('class' => 'col-xs-12 col-md-2')));
    echo $this->Form->limit('Comentario.limit', array('div' => array('class' => 'col-xs-12 col-md-2')));
    echo $this->Form->end();
    ?> 
</div>

<?php if (count($comentarios) > 0) { ?>
    <div class="table-responsive">
        <table class="table table-bordered table-hover table-condensed">
            <thead>
                <tr>
                    <th><?php echo $this->Paginator->sort('titulo','Título'); ?></th>
                    <th><?php echo $this->Paginator->sort('descricao','Descrição'); ?></th>
                    <th><?php echo $this->Paginator->sort('email'); ?></th>
                    <th class="text-center"><?php echo $this->Paginator->sort('status'); ?></th>
                    <th><?php echo $this->Paginator->sort('created','Data de Criação'); ?></th>
                    <th class="actions"><?php echo __('Actions'); ?></th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($comentarios as $comentario): ?>
                    <tr>
                        <td><?php echo h($comentario['Comentario']['titulo']); ?>&nbsp;</td>
                        <td><?php echo h($comentario['Comentario']['descricao']); ?>&nbsp;</td>
                        <td><?php echo h($comentario['Comentario']['email']); ?>&nbsp;</td>
                        <td class="text-center"><?php echo $this->Html->status($comentario['Comentario']['status']); ?>&nbsp;</td>
                        <td><?php echo h($comentario['Comentario']['created']); ?>&nbsp;</td>
                        <td class="actions">
                            <?php echo $this->Html->linkPermissao('', array('action' => 'edit', $comentario['Comentario']['id']), array('title' => __('Edit'), 'icon' => 'fa fa-pencil', 'class' => 'btn btn-xs btn-warning')); ?>
                            <?php echo $this->Html->postLinkPermissao('', array('action' => 'delete', $comentario['Comentario']['id']), array('title' => __('Delete'), 'icon' => 'fa fa-trash-o', 'class' => 'btn btn-xs btn-danger excluir_ajax'), __('Are you sure you want to delete # %s?', $comentario['Comentario']['id'])); ?>
                        </td>
                    </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
    </div>
    <?php echo $this->Paginator->pagination(); ?>
    <?php
} else {
    echo $this->element('sem_registro');
}
?>